#include "gtest/gtest.h"

#include "Graph.h"
#include "BreadthFirstSearch.h"

class BreadthFirstSearchTest : public ::testing::Test {
	protected:
		virtual void SetUp() {
		}
		virtual void TearDown() {
		}

	public:
};

TEST_F(BreadthFirstSearchTest, test1) {
	Graph g(6, false);
	g.addEdge(0, 1);
	g.addEdge(0, 3);
	g.addEdge(0, 5);
	g.addEdge(2, 3);
	g.addEdge(4, 5);

	BFS sut(g);
	sut.search(2);

	vector<int> expectedPred;
	expectedPred.push_back(3);
	expectedPred.push_back(0);
	expectedPred.push_back(-1);
	expectedPred.push_back(2);
	expectedPred.push_back(5);
	expectedPred.push_back(0);

	vector<int> expectedDistance;
	expectedDistance.push_back(2);
	expectedDistance.push_back(3);
	expectedDistance.push_back(0);
	expectedDistance.push_back(1);
	expectedDistance.push_back(4);
	expectedDistance.push_back(3);

	ASSERT_EQ(expectedPred, sut.getPredecessor());
	ASSERT_EQ(expectedDistance, sut.getDistance());
}

